package com.example.study1206.Config;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaConsumer {
    // 消费监听
//    @KafkaListener(topics = {"topic.hangge.initial"})
//    public void listen1(String data) {
//        System.out.println(data);
//    }
    // 消费监听
    @KafkaListener(topics = {"topic.hangge.initial"}, errorHandler = "myConsumerAwareErrorHandler")
    public void listen1(String data) throws Exception {
        throw new Exception("模拟一个异常");
    }
}
